package de.justphil.tcg.tcgserver.game.mechanics.event;

import de.justphil.tcg.tcgserver.game.mechanics.game.Attack;
import de.justphil.tcg.tcgserver.game.mechanics.game.BoardPosition;
import de.justphil.tcg.tcgserver.game.mechanics.game.GameDataSerializable;
import de.justphil.tcg.tcgserver.game.mechanics.monster.Monster;
import de.justphil.tcg.tcgserver.game.mechanics.util.tools.datatypes.SerializableInteger;

public class EventDataFactory {

	final static int MONSTER = 1;
	final static int ATTACK = 3;
	final static int BOARD_POSITION = 4;
	final static int NULL = 5;
	final static int INTEGER = 6;
	final static int EVENT = 7;
//	final static int PROPERTY = 2;
	
	
	
	public static GameDataSerializable getData(int dataType){
		
		switch (dataType) {
		case ATTACK:
			return new Attack();

		case BOARD_POSITION:
			return new BoardPosition();

		case NULL:
			return null;

		case INTEGER:
			return new SerializableInteger();

		case EVENT:
			return new Event();
			
		default:
			assert false;
			return null;
		}
	}

	public static int getDataType(Object obj){

		if(obj instanceof Monster)
			return MONSTER;
		else if (obj instanceof Attack)
			return ATTACK;
		else if (obj instanceof BoardPosition)
			return BOARD_POSITION;
		else if (obj == null)
			return NULL;
		else if (obj instanceof SerializableInteger)
			return INTEGER;
		else
			return EVENT;
	}
}
